
<script>
    // layui.use('element', function(){
    //     var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块
    //
    //     //监听导航点击
    //     element.on('nav(demo)', function(elem){
    //         //console.log(elem)
    //         layer.msg(elem.text());
    //     });
    // });



    layui.use('upload', function () {
        var upload = layui.upload; //得到 upload 对象

        //创建一个上传组件
        upload.render({
            elem: '#uploadBtn'
            , url: '${basePath}/file/upload'
            , done: function (rd, info, data) { //上传后的回调
                if (rd) {
                    layer.msg(rd.msg, {icon: 1});
                    uploadCallBack(rd);
                } else {
                    layer.msg(rd.msg, {icon: 2});
                }

            }
            //,accept: 'file' //允许上传的文件类型
            , size: 10000000 //最大允许上传的文件大小
            //,……

            , error: function () {
                //请求异常回调
                layer.msg("上传文件过大", {icon: 2});


            }
        });

    });

    layui.cache.page = 'user';
    layui.cache.user = {
        username: '游客'
        ,uid: -1
        ,avatar: '../../res/images/avatar/00.jpg'
        ,experience: 83
        ,sex: '男'
    };
    layui.config({
        version: "3.0.0"
        ,base: '/static/res/mods/'
    }).extend({
        fly: 'index'
    }).use('fly');



</script>
